import request from '@/utils/request'

// 获取 公示屏布局 详情
export function changePublicScreen() {
  return request({
    url: "api/v2/backend/market/style/index",
    method: "post"
  });
}

// 提交选择的公示屏布局
export function savePublicScreen(styleType) {
  const data = { styleType }
  return request({
    url: "api/v2/backend/market/style/set",
    method: "post",
    data
  });
}

// 获取设备管理数据
export function getEquipmentData() {
  return request({
    url: 'api/v1/backend/device/count_info',
    method: 'post'
  })
}

// 智慧秤 表格数据
export function getWisdomScaleData(search, status, perPage, page) {
  const data = {
    search, status, perPage, page
  }
  return request({
    url: 'api/v2/backend/balance',
    method: 'post',
    data
  })
}

// 商户经营种类
export function getBusinessType() {
  return request({
    url: 'api/v1/backend/public/business/type',
    method: 'post'
  })
}

// 获取 智慧秤设置详情
export function getScaleShow(serialId) {
  const data = {
    serialId
  }
  return request({
    url: 'api/v1/backend/serial/show',
    method: 'post',
    data
  })
}

// 提交 智慧秤设置
export function getScaleEdit(
  serialId,
  intelligentRecognization,
  buttonVoice,
  voiceSing,
  uploadState,
  statisticsShowState,
  setFontDisplay,
  businessType,
  setRoundingOff
) {
  const data = {
    serialId,
    intelligentRecognization,
    buttonVoice,
    voiceSing,
    uploadState,
    statisticsShowState,
    setFontDisplay,
    businessType,
    setRoundingOff
  }
  return request({
    url: 'api/v1/backend/serial/action',
    method: 'post',
    data
  })
}

// 保存新增电子秤
export function saveScale(serialNumber, clazz, supplierName) {
  const data = {
    serialNumber, clazz, supplierName
  }
  return request({
    url: 'api/v2/backend/balance/add',
    method: 'post',
    data
  })
}

// 报修
export function repairsScale(serialNumber, description, photos) {
  const data = {
    serialNumber, description, photos
  }
  return request({
    url: 'api/v2/backend/balance/addService',
    method: 'post',
    data
  })
}
